An1: Don't assume URL is present in both old _and_ new formats.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 22 Aug 2006 18:09:49 +0000 (18:09 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 22 Aug 2006 18:09:49 +0000 (18:09 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2311 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/an1.c

index cc15fe0fc82b89aacc97a3223e75ca9b43655558..53b661138e50cbb675bdcd66e7c43c87a655e49f 100644 (file)
@@ -415,11 +415,16 @@ static void Read_AN1_Waypoint( FILE *f, an1_waypoint_record *wpt ) {
                ofs += 2;
 
                if ( len ) {
+                       char *oldurlstr;
                        /*
                         * Trust URL encoded in new format over one in
-                        * old format.  Whack the name starting at '{URL='.
+                        * old format if both are present.  Whack the 
+                        * name starting at '{URL='.
                         */
-                       wpt->name[strlen(wpt->name) - len - 6] = 0;
+                       oldurlstr = strstr(wpt->name, "{URL=");
+                       if (oldurlstr) {
+                               *oldurlstr = 0;
+                       }
 
                        wpt->url = xcalloc( len+1, 1 );
                        memcpy( wpt->url, ofs, len );